const { defineConfig } = require('@vue/cli-service')
const MockData = require("./src/mock/index")

module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    onBeforeSetupMiddleware: function (devServer) {
      if (!devServer) {
        throw new Error('webpack-dev-server is not defined');
      }

      devServer.app.get('/api/list', function (req, res) {
          res.send(MockData.list)
      })
      devServer.app.get('/api/addlist', function (req, res) {
        res.send(MockData.list[0].children)
    });
    },
  },
})
